#unity coroutines
Explore tagged Tumblr posts
Text
here's more on how to make an RPG-like text writing system! To complete the text upon key press, you'll want to make two new bools for control and add this^ to your Update function. Checking for typeTextCoroutineRunning will prevent you from setting inputDetected true when the text isn't even being written.
For the input detection, you can choose to look for any key press you like; I like to use anyKeyDown which picks up any key press as well as mouse clicks.
then just add these checks to the TypeText function and it should work accordingly!
to note, however you go about displaying text, you'll want to make sure that two TypeText routines don't run at the same time or you'd get some weird results. for my use, I have another coroutine which calls TypeText and waits for it to finish before proceeding to whatever needs to happen next. like this:
#code snippets#unity#unity3d#i didnt even know you could yield return coroutines like that before i made this :D#very handy dandy little thing
1 note
·
View note
Text
I have spent today working on what i thought would be a simple problem but turned out to be an immense headache. But the issues I encountered in figuring it out actually inspired me to build something fun and cool on purpose!
I'd already coded a mechanic that dynamically shows the text of the game letter-by-letter, and also allows for extra pauses mid-text.
As of yesterday, I started learning a lot more about TextMesh Pro in Unity, and wanted to experiment with changing styles/fonts mid-text. There are specific use cases for this in Amadeus that I think I can have a lot of fun with.
...This is a problem, because with my dynamic text mechanic, it would literally start typing the rich text codes (" <color="red"><font=... ") on screen like it did with all of the other text, and is not interpreted as code until all of the letters of the text codes have been written one-by-one.
^ Not the user experience you want for your visual novel.
So I spent all day completely re-working how my text appearance mechanic works so that it still does the dynamic pauses, still can read rich text tags, and also doesn't show any of the rich text tags (it types them all at once so you don't see them appear). You might think this would be simple but let me tell you: it was not.
Anyway, when I was 90% of the way there I encountered this funky glitch, because I hadn't properly rewritten my new text appearance coroutine. It made this kind of stuttery spooky text appear:
....and I thought it was really cool, although decidedly not what I was trying to do.
I did eventually get it to do what I actually want it to do! [You'll just have to imagine that it is appearing letter by letter, with dramatic pauses, and that the text codes were not drawn on-screen.]
.....but I really thought I might want to keep the stuttery spooky text in my back pocket for later, so I actually created a switch I can toggle if I want to make fucked up text on purpose!
Anyway, I'm not sure precisely where I will actually use this but I fully intend to. [rubs hands together evilly]
#misc updates#teaser#note that im not completely sold on using this font but i was using it to experiment with whether the text styles were actually updating#from the rich text tags as intended
13 notes
·
View notes
Text
Not only is TEXT FADE-IN REAL I have also made a (ugly default asset... For Now) slider that lets you adjust the text appearance speed. Baby has learned how to use static variables and coroutines in Unity
2 notes
·
View notes
Text
Development - 04/04
Today, I want to get some playtesting done, though at the moment there isn't much to playtest:
So I think I will add sounds to my game and get people to playtest the pacing between the monster and exploring the dungeon.
To do this, I make a couple of sounds on jsfxr and export them to Unity:
The two sounds I made are for the monster's and player's footsteps. Starting with the player footsteps, I make a new coroutine where it plays the sound on a delay depending on whether the player is sprinting or not:
For the monster, I made a new script that would receive information about how to play the footsteps from the monster script. The reason I can't just do this in the monster script is because the timers on the flee state would stop the sound from playing:
So I have link this up , but the fleeing state is giving me even more problem. Basically, this line should be triggering but isn't (even though the Debug.Log line UNDER it is triggering):
So after a while of bashing my head against the monitor attempting to workout why this won't work, I had an idea. I believe that it is resetting the timer before it can start again, though this doesn't explain why ONLY the flee state won't work:
So I try with these if statements making sure the timer can be reset:
No luck.
I think I am putting this on hold for now, as it isn't too important.
0 notes
Text
Dev Day Nine
I'm starting to stress that the deadline is next week, however I don't have all that much left to do.
Here's what I have left to do:
make the outside better ✔
add more negative effects
make the shop and the effects ✔
make models for the items
decorate the store (bonus)
make the shop look better (bonus)
add a death screen ✔
make it so that the player can win
------
Starting off today I made some positive effects the player can buy.
Then I made the outside look better by having less trees, making a shoddy car model and turning this bit into a car park. If I have time I may add buildings behind the wall just to make it seem less like the store is in the void.
I toggled fog on and made fairly scarce just for added effect.
Heres an example of a coroutine, I'll make a seperate blog post on what I have learnt for future use:
This, however froze unity; so I had to close out with task manager and retry it. Instead of every frame, I made it every second:
This also froze my project (pretty ironic the grapes of stillness keeps freezing my project). I have always found while loops to be a pain, so I'm not too surprised by this.
I took a break from this and worked on the game over screen for a bit.
I decided it was easier to put the while loop in the Update method rather than a coroutine.
This works just as intended.
Now I'm going to make it so that the player can actually win the game, and have a goal to work towards. My main idea is that there will be an alarm clock the player has to spend their extra time to make it reach 0, thus letting them leave the store.
This is the model I made:
It works pretty much the same as every other interactable object in my game, it glows green and you can left click it.
It will show a screen when at 0 that lets the player know that the game is done. I just copy and pasted the game over screen and made a few changes as I am planning on changing this later.
0 notes
Text
Week 6 - 8 Updated Sprites and QTE
After our first testing week, I quickly updated the existing character sprite by making It half the size and using a more consistent planet. the sprite in the top left is the original, and I experimented with simplifying the overall shape and changing the colour of the main character's tracksuit, once I was happy with the colours and shape, I started rendering the piece by adding shadows and highlights.
I wanted to imitate a similar sprite style, which can be found in the game Mad Panic Coaster and I think I managed to achieve the detailed cartoony look quite well. I then gave the new sprite to one of our artists who then animated it and created a lot of new frames.
QTE System
Since our game is meant to be a party racer, we wanted to focus on including other fun mechanics in the game other than strictly driving mechanics. I focused on creating a Quick Time Event (QTE), which the player would be able to initiate at any time and, on a successful pass, would heal the player, allowing them to drive for longer.
The QTEs work by generating a number between 1 and 4; if the number is 2, then the code will count the correct key to be 2 and 1, 3, and 4 will be incorrect. There is controller support, so 2 can either be 2 on the keyboard or B on an Xbox controller, this was done using Unity's input manager.
there are 3 coroutines that can occur, the 1st coroutine is based on the player pressing the right key, the code will then display as correct and will add 1 to the number of QTEs done, the code will then generative a new number an will await the player to input a key.
if the player presses the code, it will display as incorrect, and no number will be added to the number of QTEs done, the code will then generate a new number and will await the player to input a key.
If the player presses nothing for a second the third coroutine will activate and will display as false to the player, again no number will be added to the number of QTEs done, the code will then generate a new number and will await the player to input a key.
Numbers will keep on generating until the player manages to complete 3 QTEs, at which point the QTE will stop, the player will be rewarded with max health, and the number of QTEs will be set back to 0.
The QTEs can only activate when the player presses the button to initiate the QTE, and when the number of QTEs done is 0, this will ensure that you can only ever activate one QTE minigame at a time, and you will be unable to activate another until you complete the first one.
0 notes
Text
Actually making the dungeon crawler
Ok so I first started by creating the Unity project (default 3d, built in render pipeline, etc...) and imported Probuilder. Probuilder basically lets you do 3D modeling directly inside of Unity, which is usefull for prototyping stuff and, in my case, I could probably even get away with using it in the final product. Here's the test environment I made:
Anyway I next worked on the input.
Input in Unity is really easy, like you can just do Input.GetAxis("Horizontal"); and it will get you the AD and ←→ input. However, I need to make things overcomplicated so I decided to use Unity's new input system. All you really need to know about it is that it lets you get any input imaginable and do what you want with it. Here's what I ended up with for now:
I then created a new script called "Player Input Manager" to control all of the input that happens, rather than calculating it for everything separately. It might look a bit confusing, but it works:
the "_" is the context, I just couldn't be bothered to write context or ctx like 7 times.
The movement is actually quite simple. Usually I would just use the Character Controller built into unity, but this time I'll be using the Rigidbody because I'm gonna be using a lot of physics.
the whole "moveInput.x * transform.right + moveInput.y * transform.forward" might look a little strange, but that's just because the camera controller script will be rotating the player itself, and this just makes sure the player is moving in the correct direction.
Speaking of the camera controller, this is what I came up with:
I say I came up with it, its actually from Brackeys' first person tutorial, I just don't have any other method. There are a few problems with it, first off its really jittery because I'm using Rigidbodies, but its also using the old input system. ill definitely fix this later, but I wanna get onto the actual main source of movement: the shotgun.
the recoil basically works by adding a force opposite to where the camera's looking whenever you shoot. The way I add a cooldown is also pretty standard. Rather than putting the shooting logic in another function (void), I put it in a Coroutine, this then allows me to add a delay. The basic layout of the Coroutine is something I've done hundreds of times and all of the logic just goes between the "canShoot = false;" and "yield return new WaitForSeconds(...);"
It already feels pretty nice to use, but it also feels a bit too floaty. One thing I could try is resetting the player's velocity every time they shoot, meaning they aren't fighting against themselves and the physics all the time. Here's how it looks:
Unfortunately Tumblr doesn't like me directly uploading videos so idk
Overall, its pretty good for now, but still needs a bit of work.
0 notes
Text
Optimizations
Unfortunately, my game isn't really the fastest, regularly dropping from 300fps to 100fps. Here are some of the optimizations I have added to bring it to 250fps+.
First off, I added the impact particles from the bullets as a child of the bullet, and activate it on impact. Originally, I planned to create a separate object pool for the particles, but that turned out to be slower.
I then made it so that every light source is only enabled when the player is close enough. Because I really don't need to be calculating lights if they're not being seen.
As you can see, in the Awake() function (which is run once at the start of the game), I get references to the light and the player, and in the FixedUpdate() function (which runs a fixed amount of times per frame), I check if the light exists and if it is close enough to the player and, if it is, I render it. Otherwise, I just disable it.
Then, I changed some rendering settings, making the normal-mapped lighting texture a slightly lower resolution. Now that I had added the particles to the pool, not many rendering things needed to be optimized and this really didn't make much of a difference.
There wasn't really much more I could do, and now it takes around 3ms and 2ms on the cpu and gpu, where it was taking 12ms and 5ms (or something around there).
Ideally, I would use unity's DOTS for the shooting, but it uses a coroutine and I couldn't figure out how to make that work.
As you will be able to see in the video, when the player gets far enough away, the green light is hidden, but when the player gets close enough again, it re-appears. The effect has been drastically amplified (I just lowered the distance) for the purpose of the video:
Another thing I could have done to make this better was, instead of just disabling and re-enabling the light source, I could make it so it gets darker the further away you got, making the effect of it popping in and out less noticeable.
0 notes
Text
QUITTING THE GAME AFTER SOME TIME ::
For this project, I needed it to be able to quit after around 60 seconds if nobody touches it. Here's how I did it:
First, I open my game manager script, which contains stuff like saving and reloading.
I create a new Coroutine, this is because I want to be able to use "yield return new WaitForSeconds(...);".
I first check if the player isn't moving, then I start a timer of 60 seconds. After the 60 seconds, I check if the player is in the same position as last time and, if they are, I use Unity's "Application.Quit()" function to quit the game. If the player has moved, I just return out of the function.
Additionally, to make it so the game quits when a button is pressed, I can just use Input.GetKeyDown(KeyCode.[KEY]) instead of checking for if the player has stayed still for some time.
0 notes
Text
Development of the "Jewellirium"
For "Jewellirium" we took on every aspect ourselves, including designing a custom font (no free Comic Cats like in "Brotula"). We used the Unity Engine, delving into coroutines, animations, and exploring numerous new functions. The mentoring of Headlight School was very helpful during the process!
0 notes
Text
Day 2
soo i will continue where i left off (i am silly little dumb dumb, i accidentally deleted this post and now i'm writing it again)
what i have studied today:
RequireComponent() attribute seems really useful, and on the other hand i have no idea where i'm going to use AddComponentMenu attribute. i guess it will come to me;
raycasting. ray, hit, spherecast, now i can do pew paw;
ScreenPointToRay()... i have a feeling that i dont get it right and it works not right in the game. i wiil read more about it later;
coroutines, yay, i love coroutines! i'm glad i can learn more about it;
finite state machine or FSM. welp, i'm gonna use it in my taking over the world plan with AI;
i wanna keep it in mind. TransformPoint() function can help me establish position relative to another object by vector;
prefabs. i wasnt confident in this topic, so repetition was good for me. i need to use more prefabs! and with Instantiate() function i can use them in scripts;
OnTriggerEnter(). just OnTriggerEnter(); i have a feeling that i forgot something, but, well, bad luck GENERALLY: repeated and delved into some topics like prefabs and coroutine, learned some new stuff, get a proper understanding of raycasting. and now i have an enemy in my unity project that fires at me with fireballs :D
1 note
·
View note
Text
Start, Awake, Update and StartCoroutine in Unity.
In Unity, Coroutines leverage C#'s IEnumerator/yield syntax feature to easily let you write stepwise behaviors that execute over a longer amount of time/over multiple update cycles within just one method.
But when exactly do they get executed?
Of course, some of it is documented in their classic manual page: Order of Execution (2021.3)
But there's a strange thing I didn't really think of when I started using Coroutines so I thought I'd document it here.
When does the first step of a coroutine execute? And if I started a coroutine in Awake, and another in Start, would the code after yield null execute sequentially after the next Update?
The answer may not be what you expect.
Here's some code to test:
Stick it on a GameObject, run the scene and let's see what we got.
huh...
A few notable observations:
Stuff before the first yield null execute immediately as if they were where the StartCoroutine call is.
Using StartCoroutine in Start seems to make the first yield null skip one Update. This kind of makes practical sense, since the common intention of a yield return null is you want it to wait for one update. If it happened in the first update after Start, it would be as if it didn't wait at all.
So really, the thing to remember is: Stuff after the first yield null in Awake executes right after the first update. Stuff after the first yield null in Start executes right after the second update.
1 note
·
View note
Text
free course site
freecoursesite freecoursesite python for data structures, algorithms, and interviews! free download learn assembly language by making games for the atari 2600 free download javascript from beginner to professional download digital marketing the ultimate guide to strategic marketing free download build 15 augmented reality (ar) apps with unity & vuforia free download c++: from beginner to expert download c++: from beginner to expert download c++: from beginner to expert download online course download online course free download build 15 augmented reality (ar) apps with unity & vuforia download online course online courses download download online courses python for data structures, algorithms, and interviews! download free download online course algorithms and data structures in python (interview q&a) free download free course online download download courses online spring framework in easy steps free download online courses free download the ultimate guide to making a 2d strategy game in unity kotlin coroutines for android masterclass download the git & github bootcamp udemy free download internationally accredited diploma certificate in nutrition download coursefreedl free online course download mern stack - react node from scratch building social network free download javascript tutorial and projects course (2022) torrent master responsive web design css grid, flexbox & animations pre-programming: everything you need to know before you code download the complete developers guide to mongodb download mastering data science and machine learning fundamentals the comprehensive android app development masterclass free download ultimate google ads training 2021: profit with pay per click torrent flutter rest api development course: build a movie app flutter 1.2 with firebase&stripe build shop app from scratch complete guide to tensorflow for deep learning with python download next.js react node javascript mern lms elearning marketplace free download the comprehensive android app development masterclass 2022 complete python bootcamp from zero to hero in python torrent download boxing training course complete workout set free download martial arts course free download data structures & algorithms essentials using c++ (2022) download mvvm design pattern using swift in ios free download complete python bootcamp from zero to hero in python download gui development with python and tkinter free download download spring framework in easy steps master computers - from beginner to expert in one week home business: the complete cpa marketing course free download the complete youtube course by youtubers with 100mn+ views free download the comprehensive android app development masterclass download node.js, express, mongodb & more: the complete bootcamp 2022 download free next.js - build full stack apps with next.js using redux free download selenium java test framework & best practices - masterclass html&css tutorial and projects course 2022 (flexbox&grid) torrent python zero to hero udemy free download learn social engineering from scratch freecoursesite learn social engineering from scratch download learn social engineering from scratch download python beyond the basics - object-oriented programming php course free download node.js, express, mongodb & more: the complete bootcamp 2022 free download english for beginners intensive spoken english course free download english for beginners: intensive spoken english course free free courses download sites ebay dropshipping course free download udemy course download online photoshop master course: from beginner to photoshop pro advanced amazon marketing - the complete amazon ads course home business: the complete cpa marketing course drupal tutorial: drupal 8 beginner to advanced in 8 projects node.js api masterclass with express & mongodb download python django 2021 - complete course amazon kdp course free download amazon kdp course free download building perceptive ai in unreal engine javascript tutorial and projects course master matlab through guided problem solving network hacking continued - intermediate to advanced free download python django 2021 – complete course pre programming course selenium webdriver with java -basics to advanced+frameworks free download the complete mobile ethical hacking course freecoursesite english for beginners: intensive spoken english course torrent react for the rest of us english for beginners intensive spoken english course udemy free download machine learning use in flutter the complete guide write php like a pro: build a php mvc framework from scratch write php like a pro: build a php mvc framework from scratch digital marketing masterclass:get your first 1,000 customers freecource site stripe masterclass with react.js & node.js react native expo for multiplatform mobile app development 2022 complete python bootcamp from zero to hero in python free the git & github bootcamp download learn api technical writing: json and xml for writers download full stack mern bootcamp free download embedded systems programming on arm cortex-m3/m4 processor free download react native and redux course using hooks learn elementor - wordpress front-end development course free download hip hop dance for beginners udemy free download mongodb - the complete developer's guide 2020 accelerated javascript training download java puzzles to eliminate code fear laravel multi user blogging platform with seo (2 projects) laravel multi user blogging platform with seo (2 projects) microcontroller embedded c programming: absolute beginners udemy free download freecourse download learn social engineering from scratch free download learn social engineering from scratch free download coursefreedownload html & css tutorial and projects course node.js api masterclass with express & mongodb freecoursesite free cource site real world python test automation with pytest (django app) prateek narang udemy course free download freecourse.dl download complete web design course: html, css, javascript and jquery free corse site laravel classified ads web application from scratch the bible of competitive programming & coding interviews 2022 complete python bootcamp from zero to hero in python for free 2022 complete python bootcamp from zero to hero in python freecoursesite the complete flutter ui masterclass | ios, android, & web complete web design course: html, css, javascript and jquery download course free download node.js, express, mongodb & more: the complete bootcamp 2022 free node.js, express, mongodb & more: the complete bootcamp 2022 torrent amazon affiliate course free download the complete android ethical hacking practical course c|aehp learn perl 5 by doing it how to make a retro style 3d fps in the godot game engine the web developer bootcamp 2022 free download course downloader course download free the bible of competitive programming & coding interviews free download data analysis masterclass (4 courses in 1) javascript tutorial torrent udemy ros course free download udemy ros course free download next.js - build full stack apps with next.js using redux course download cold email mastery free download free couse site full stack web development and ai with python introduction to windows powershell 5.1 download freecoursessites capital market immersion youtube course free download youtube course free download the python programming comprehensive bootcamp frecourse site react, context & sass build a real world responsive website offensive approach to hunt bugs unreal engine 4 – multiplayer souls-like action rpg by devaddict free course downloads unity game development create 2d and 3d games with c# free download data structures and algorithms essentials courses free download freecoursite football tactics course free learn to build an e-commerce app with .net core and angular free download freecourssite 2022 complete python bootcamp from zero to hero in python embedded linux step by step using beaglebone black free download intensive spoken english course for beginners freesoursesite java from beginner to expert download full stack programming for complete beginners in python spring boot udemy course download spring boot udemy course download free course download free download course the complete mobile ethical hacking course free download download any course for free calisthenics course free download mern stack – react node from scratch building social network udemy django course free download full web ethical hacking course freecoursesite python gui programming using tkinter and sqlite3 freecouresesite become a great singer: your complete vocal training system udemy couse free download freecoursesites download free course download node.js, express, mongodb & more: the complete bootcamp 2022 freecourse online freecoursites the complete mobile ethical hacking course download freecoursesote arp spoofing &man in the middle attacks execution &detection a beginner's guide to augmented reality with unity how to start an amazon fba store on a tight budget download freecourse site the complete python/postgresql course 2.0 introduction to windows powershell 5.1 ultimate google ads training 2021 reverse engineering: ida for beginners the complete mailchimp email marketing course free download master electron: desktop apps with html, javascript & css qt 6 c++ gui development for beginners : the fundamentals react front to back 2022 free download the complete self-driving car course - applied deep learning css - the complete guide 2022 (incl. flexbox, grid & sass) free download algorithms and data structures in python (interview q&a) download c# performance tricks: how to radically speed up your code english for beginners intensive spoken english course boxing training course, complete workout set learn network hacking from scratch (wifi & wired) freecoursesite learn network hacking from scratch (wifi & wired) freecoursesite microcontroller embedded c programming: absolute beginners download free coursite end to end java project development using spring boot esp32 for arduino makers python for data structures, algorithms, and interviews! freecourses download unity 2020 urp make a juicy 2d shooter prototype udemy course free downloader go java full stack with spring boot and angular download complete asp.net mvc course in c# free couse download ultimate web designer & web developer course download udemy course online free paid course download bug bounty hunting course free download powermta server + ip rotation powermta server + ip rotation algorithmic trading a-z with python machine learning & aws free download from 0 to 1: data structures & algorithms in java complete python bootcamp: go from zero to hero in python 3. node.js api masterclass with express & mongodb free download learn c++ for game development free download the complete flutter ui masterclass udemy lightroom course free download next amazona: build ecommerce website like amazon by next.js paid course download microcontroller embedded c programming absolute beginners free download free paid courses download react testing with jest and enzyme free download the complete mobile ethical hacking course free tensorflow 2.0: deep learning and artificial intelligence complete course in autocad electrical 2021 node js udemy course free download node js udemy course free download free course downloader data structures and algorithms in python udemy free download embedded linux step by step using beaglebone black building recommender systems with machine learning and ai free download api testing with restsharp and specflow in c# download seo training course by moz free download free courses download udemy ros for beginners basics motion and opencv download courses free learn assembly language by making games for the atari 2600 full mobile hacking course freecoursesite free cource download complete wordpress theme & plugin development course 2021 free download tech explorations arduino step by step the beginner's guide to artificial intelligence in unity free download django ecommerce build advanced django web application download courses for free the web developer bootcamp 2022 torrent freecoursesite online courses free download the web developer bootcamp 2022 download coursedownload 2022 complete python bootcamp from zero to hero in python the web developer bootcamp 2022 free download online course download node.js, express, mongodb & more: the complete bootcamp 2022 download freecoursesites 2022 complete python bootcamp from zero to hero in python free python django 2021 - complete course free download free online course download english for beginners: intensive spoken english course download udemy course for free
2 notes
·
View notes
Text
'Why I Made A Game' or 'How I Learned To Stop Sleeping And Love The Coroutine'
Preamble Ramble.
My love for computers and computer games started when my dad bought a BBC Micro B. Whilst the machine is ancient by today’s standards, at the time it opened a whole new world for me. Games such as Repton, Chucky Egg, Citadel and a weird kangaroo game that I can't remember the name of (if anyone does know, I would be eternally grateful) took up most of my time, but what really intrigued me, was a copy of the BBC Microcomputer System User Guide that came with the computer.
In the said user guide, were large sections explaining how to use the basic language, what could be achieved and how to save your programs to tape. A quick skim read later and I started to write my own text adventure games...short, badly written text adventure games, but MY short badly written text adventure games nonetheless.
Fast forward thirty-something years and a slew of computers and consoles later and I was still no closer to writing a full game. Now in my adult years, being a professional Composer, I work with others that have seen game projects through from concept to release. Although I love doing what I do, I was always a little jealous that I hadn't managed to do the same.
Coronavirus Has Entered The Chat.
My year so far has sucked, as I'm sure it has for most people. I lost my dad at the beginning of the year and shortly before that, my grandad. My family and I were stuck in a mould infested flat with no sign of ever escaping. I was depressed and felt quite hopeless. There was no light at the end of the tunnel.
One indistinguishable bleak day, I was going through some files on my desktop and stumbled upon an old unity project that I’d started, called ‘Don`t Die Dickhead’. The project was a basic rage platformer that I’d made as a kind of joke, to piss off any friends and family that were willing to play it. It had three levels, controls that sort-of worked and was completely unfair. My ADHD brain latched onto the idea and before I knew it, I was working on it again; my goal, make ten levels and put it on Steam. I didn't really believe that I'd do it, but I was utterly committed to at least trying to finish it this time. Even though, at that point, I didn't really know where the game was going.
Game Design By Osmosis.
My game design process went something like this ‘make the game tough but fun and if any ideas that you like come to you, implement them...if you can’, That was quite honestly the extent of it. I'd spend time coming up with level design ideas and then add extra problems or aesthetic choices as they came to me.
The game's core revolves around chaos, so that's how it should be created, I thought. That being said...Having a solid idea before you start is a fantastic idea and something I'll definitely do from now on. The more I added to the game, the more I realised that I had to make some sort of a plan.
I added a bunch of parody levels based on games that I like, but then had to figure out how I'd work them into the project. I settled on the idea of every level or collection of levels being different tv shows or stations. As the player progressed, the channels changed and the overall aesthetic changed with it. It was at this point that I actually had to sit down and design it a little more seriously.
When In Doubt Move To Malta.
During this time, my wife and I, disillusioned with the UK government, decided that we no longer wanted to live in the UK. We’ve always had a soft spot for Malta, so we decided to go for it, try living there for a couple of months and if it all works out, begin the process of becoming residents.
Luckily composing had been good to me during lockdown and my wife's blog had started to take off, so we found ourselves in a very unique position. Off we went. Taking the bare minimum with me, an external harddrive, a nanokeys keyboard, My Ollo Audio headphones and a laptop, my intention was to continue working (Scoring a fantastic film at the moment) and finish the game.
After acclimating myself to the new environment, lizards in the house, mosquitos, hornets the size of your fist and 38 degree weather in September, I got back to work. Please believe me when i say ENVIRONMENT MAKES ALL THE DIFFERENCE! Psychologically, the change in environment for me was incredible. I felt far more creatively available and finishing ‘DDD’, for the first time, didn't seem impossible.
And So Here We Are.
Since arriving in Malta, I’ve worked my sexy ass off. When not composing I was coding, when not coding I was creating artwork, when not creating artwork, I was playing the same goddamn level for what seemed like the thousandth time. I changed the name to ‘Don't Die! Douche!’, I made a trailer, I paid for a Steam page (well if we’re honest, my wife did!!), I hassled people to bug test it. Before too long, it was finished. I’d done it!
I'm still in shock to be honest and i'm pretty sure it'll take quite some time to sink in. Its a dumb game, its annoyingly tough in places, more than a little bit surreal. But, it’s my dumb game and I love it.
Final Thoughts.
I guess this whole piece is just my stab at being motivational. Please believe me when I say that If I can do it, so can you! Start small, work consistently, but most importantly make something that you want to make. Ignore trends, do your own thing. I'm not saying that you need to do something revolutionary, just something that has your personality built into it. Having a personal connection to your project makes a big difference. I hope this has been, at the very least entertaining and potentially motivating. Either way, thanks for reading.
If you want to check out ‘Don't Die! Douche!’ I’ll pop the steam page link below.
Take care and try to be nice to one another.
Big Love
Matt
https://store.steampowered.com/app/1399990/Dont_Die_Douche/
1 note
·
View note
Text
Rogue-like room generation Polterheist style part 1.
I have seen people asking about randomized room or dungeon layout in Unity using the tilemap system around and generally on reddit. I have helped a few people with simple ways of doing it and some people who wanted more robust generation. It has occurred to me through this process that I haven’t really documented many technical aspects of how Polterhiest works. So in lieu of helping another person muddle through their code on how to create a procedural generated dungeon, I figured I would just show under the hood of Polterhiest in a series of tutorials. Hopefully it will help someone else, and hell I might even get some feedback on how I can do this process better in the future (all though I am a year plus into Polterhiest development so I am kinda married to the process.
The Basics:
First things first I had to get out of the mind set of writing to a single tile map as this became cumbersome to check. An individual tilemap for each room became much easier to control and able to be refined. If you think of the Polterhiest dynamic room generation as a stepped flood algorithm where each room spawns one by one then uses a series of physics checks to tell from it’s acceptable exits where the next room can spawn and so on until all rooms are spawned. Then hallways get cleaned up. Then exits to new areas area applied. The basic run down is roomspawn->physics check exits->Connecting hallway->physics check for room size->next room spawn ext.
In the end you get something like this. This is the main house which spawns from four seeds to create wings with exits to sub sections of the game. Don’t worry I will explain each step of how this gets done in depth and with code.
Basic room setup:
First I needed to establish some basic room scale through testing of how big I wanted for each room of the dungeon to be as a play area and the max size to still feel reasonable was a 20x20 grid area. From here I narrowed that my room prefabs could be 4 basic sizes: 10x10, 10x20, 20x10, and 20x20. The rooms can be any shape along that scale but they need their exits to be along those values around the exit of the room.
I started by making template prefabs of each scale, set up their necessary components and began testing.
Basic room construction:
Every room prefab needs 3 essential components:
A trigger collider for the bounds of the room
Exit transforms
Exit colliders to determine safety of spawning hallway attached to room
The room trigger collider is set to those basic 4 possible room scales and this allows collision during spawning to ensure rooms do not spawn on top of one another.
Once the first room is placed from the seed point there will be a momentary pause in the coroutine for spawning that allows on awake code on each of the orange exit colliders to be called. If they collide with another room then that exit will be removed from the list of acceptable exits for each room and the sprites will be turned into wall sprites and collider is turned on to block the wall.
After all checks per room (and I will share code) are complete then the room will randomly decide an exit or pair of exits from itself based of remaining exits in the list of possible exits and tells the seeding controller to spawn hallways out of those exits.
https://pastebin.com/PKvxzXfi
This is the code that handle the room once it has been placed. Obviously it will make more sense with the code that controls it which I will add all at the end of each post. Hallway placement
After a room is placed i tells the master controller where exits should spawn from and hallways are attached. You may not need hallways and can add connecting rooms but as my game is supposed to be a fancy rich house connecting hallways between each room felt appropriate and having hallways allowed the necessary following physics checks for room size that was acceptable. Additionally because of the 4 cardinal directions of my rooms I only needed 2 prefabs of hallways for each area a North/South and a East/West.
Basic hallway set up only required a trigger collider for area and attach point transforms for exits. The previously spawned room passes it’s components to the spawn controller which offsets exits based off the exit from the previous room then the hallway fires 4 checks of physics overlap all boxes out of it’s other exit to determine the acceptable rooms that can be spawned out of the room and tells the controller what size rooms can be attached to this hallway.
If you wanted to remove hallways then the physics check can be down out of the edge of your current rooms existing door attach point. The hallway controller that handles these physics checks:
https://pastebin.com/4Lc4n4EG
The spawn controller:
The seed controller has several values that can be altered. Preferred direction gives some control over the direction from which rooms will tend to spawn, a list of prefabs to use for various room sizes, hallway prefabs, and a required room set.
Once the seed has spawned the expected amount of rooms it stops. Then a custom check is called to all existing hallways to see if any where spawned out of previous rooms and failed to build a child room to attach to them.
Once that is done the seeder will place exit rooms based off the overall seeds expected exits. My seed controller: https://pastebin.com/M6X2T8DN This is all the basic set up and coding on how Polterhiest procedural generates areas for the player to go through. There is a lot of missing architecture for each area and you probably will not be able to copy and paste my code directly into your game but you can use it as a jumping off point. Next I will write up a blog on each piece of code works in depth starting with the master controller so hopefully people can follow along and get started on their own projects. Note: This code is all missing my static persistence class which has several static declarations for directions and file saving. I am not quite ready to share those because it contains parts of my game that are supposed to be a surprise to the player. when I do an in depth code dive I will work around this the best I can to be helpful.
1 note
·
View note
Text
Unity: Coroutines
What is
A method that can suspend (or yield) its execution until the yield instructions you defined are met. For example, when I player’s health reaches zero, we’ll want to start the KillPlayer coroutine. First we’ll trigger the death animation. Then we need to yield (wait) until animation is done. Finally, we restart level. Yielding needs to happen otherwise the death animation will start and then the level will immediately restart and we’d never see the animation.
StartCoroutine(CoroutineName());
IEnumerator CoroutineName() { // Things to do yield return SomeCondition // Things to do }
1 note
·
View note